<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>CoCo自定义控件代码检查工具</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <link href="https://fonts.googleapis.com/css2?family=HarmonyOS+Sans:wght@300;400;500;700&display=swap"
        rel="stylesheet">
    <link href="https://cdn.bootcdn.net/ajax/libs/codemirror/6.65.7/codemirror.min.css" rel="stylesheet">
    <script src="https://cdn.bootcdn.net/ajax/libs/codemirror/6.65.7/codemirror.min.js"></script>
    <style>
        :root {
            --primary-blue: #1890ff;
            --light-blue: #e6f7ff;
            --dark-blue: #096dd9;
            --accent-blue: #40a9ff;
            --white: #ffffff;
            --light-gray: #f5f5f5;
            --dark-gray: #595959;
            --warning: #ffb300;
            --error: #ff4d4f;
            --success: #52c41a;
            --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
            --radius: 12px;
            --transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
            --light-red: #fff1f0;
            --medium-red: #ffccc7;
            --dark-red: #ff4d4f;
            --light-yellow: #fffbe6;
            --medium-yellow: #ffe7ba;
            --dark-yellow: #faad14;
            --accent-blue: #1890ff;
            --gray: #f0f0f0;
            --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
            --transition: all 0.3s ease;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            background: linear-gradient(135deg, var(--light-blue), var(--white));
            color: #333;
            min-height: 100vh;
            padding: 20px;
            display: flex;
            justify-content: center;
            align-items: center;
            font-family: 'HarmonyOS Sans', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            overflow-x: hidden;
            position: relative;
        }

        /* 粒子背景效果 */
        .particles {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: -1;
            overflow: hidden;
        }

        .particle {
            position: absolute;
            background: rgba(24, 144, 255, 0.15);
            border-radius: 50%;
            animation: float 15s infinite ease-in-out;
        }

        @keyframes float {

            0%,
            100% {
                transform: translate(0, 0) rotate(0deg);
            }

            25% {
                transform: translate(20px, 40px) rotate(90deg);
            }

            50% {
                transform: translate(40px, 20px) rotate(180deg);
            }

            75% {
                transform: translate(20px, 0) rotate(270deg);
            }
        }

        .container {
            width: 100%;
            max-width: 1400px;
            background: rgba(255, 255, 255, 0.92);
            border-radius: var(--radius);
            box-shadow: var(--shadow);
            overflow: hidden;
            animation: fadeInScale 0.6s cubic-bezier(0.23, 1, 0.32, 1) forwards;
            transform: scale(0.95);
            opacity: 0;
            backdrop-filter: blur(8px);
            border: 1px solid rgba(230, 247, 255, 0.8);
        }

        @keyframes fadeInScale {
            0% {
                transform: scale(0.95);
                opacity: 0;
            }

            100% {
                transform: scale(1);
                opacity: 1;
            }
        }

        header {
            background: linear-gradient(120deg, var(--primary-blue), var(--accent-blue));
            color: var(--white);
            padding: 28px 40px;
            text-align: center;
            position: relative;
            overflow: hidden;
            border-bottom: 1px solid rgba(255, 255, 255, 0.2);
        }

        header::before {
            content: '';
            position: absolute;
            top: -50%;
            left: -50%;
            width: 200%;
            height: 200%;
            background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, transparent 70%);
            transform: rotate(30deg);
            animation: shine 8s infinite linear;
        }

        @keyframes shine {
            0% {
                transform: rotate(30deg) translateX(-100%);
            }

            100% {
                transform: rotate(30deg) translateX(100%);
            }
        }

        .logo-container {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 15px;
            margin-bottom: 15px;
        }

        .logo {
            width: 60px;
            height: 60px;
            background: var(--white);
            border-radius: 18px;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 6px 16px rgba(24, 144, 255, 0.3);
            animation: float 4s ease-in-out infinite;
        }

        .logo i {
            font-size: 28px;
            color: var(--primary-blue);
        }

        @keyframes float {

            0%,
            100% {
                transform: translateY(0);
            }

            50% {
                transform: translateY(-12px);
            }
        }

        h1 {
            font-size: 2.8rem;
            font-weight: 700;
            margin-bottom: 8px;
            text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
            animation: textGlow 2s infinite alternate;
        }

        @keyframes textGlow {
            0% {
                text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
            }

            100% {
                text-shadow: 0 0 20px rgba(255, 255, 255, 0.8), 0 0 30px rgba(255, 255, 255, 0.6);
            }
        }

        .subtitle {
            font-size: 1.3rem;
            opacity: 0.92;
            font-weight: 300;
            max-width: 700px;
            margin: 0 auto;
            line-height: 1.6;
            animation: fadeIn 1.5s ease-out;
        }

        @keyframes fadeIn {
            from {
                opacity: 0;
            }

            to {
                opacity: 0.92;
            }
        }

        .content {
            display: flex;
            flex-wrap: wrap;
            padding: 30px;
            gap: 30px;
        }

        .input-section,
        .output-section {
            flex: 1;
            min-width: 300px;
        }

        .section-title {
            font-size: 1.6rem;
            margin-bottom: 20px;
            color: var(--dark-blue);
            display: flex;
            align-items: center;
            gap: 12px;
            padding-bottom: 12px;
            border-bottom: 2px solid var(--light-blue);
            position: relative;
        }

        .section-title::after {
            content: '';
            position: absolute;
            bottom: -2px;
            left: 0;
            width: 80px;
            height: 2px;
            background: var(--primary-blue);
            border-radius: 2px;
            transition: var(--transition);
        }

        .section-title:hover::after {
            width: 120px;
        }

        .section-title i {
            font-size: 1.8rem;
            color: var(--primary-blue);
            transition: var(--transition);
        }

        .section-title:hover i {
            transform: scale(1.1);
        }

        .code-input-container {
            height: 500px;
            position: relative;
            border-radius: var(--radius);
            overflow: hidden;
            box-shadow: var(--shadow);
            transition: var(--transition);
            animation: slideInLeft 0.8s ease-out;
        }

        @keyframes slideInLeft {
            from {
                transform: translateX(-30px);
                opacity: 0;
            }

            to {
                transform: translateX(0);
                opacity: 1;
            }
        }

        .code-input-container:hover {
            box-shadow: 0 8px 20px rgba(24, 144, 255, 0.15);
        }

        .code-input-header {
            background: linear-gradient(to right, var(--light-blue), var(--white));
            padding: 12px 20px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            border-bottom: 1px solid rgba(230, 247, 255, 0.5);
        }

        .code-input-header span {
            font-size: 0.9rem;
            color: var(--dark-blue);
            font-weight: 500;
        }

        .code-input {
            width: 100%;
            height: 100%;
            padding: 20px;
            border: none;
            background: var(--light-gray);
            font-family: 'Consolas', 'Courier New', monospace;
            font-size: 15px;
            resize: vertical;
            transition: var(--transition);
            line-height: 1.6;
            color: #333;
        }

        .code-input:focus {
            outline: none;
            background: var(--white);
        }

        .upload-area {
            border: 2px dashed var(--primary-blue);
            border-radius: var(--radius);
            padding: 30px 20px;
            text-align: center;
            margin: 20px 0;
            background: rgba(230, 247, 255, 0.4);
            cursor: pointer;
            transition: var(--transition);
            position: relative;
            overflow: hidden;
            box-shadow: var(--shadow);
            animation: slideInRight 0.8s ease-out;
        }

        @keyframes slideInRight {
            from {
                transform: translateX(30px);
                opacity: 0;
            }

            to {
                transform: translateX(0);
                opacity: 1;
            }
        }

        .upload-area::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(45deg, transparent, rgba(24, 144, 255, 0.1), transparent);
            animation: slide 2s linear infinite;
            z-index: 0;
        }

        @keyframes slide {
            0% {
                transform: translateX(-100%);
            }

            100% {
                transform: translateX(100%);
            }
        }

        .upload-area:hover {
            background: rgba(230, 247, 255, 0.7);
            border-color: var(--accent-blue);
            transform: translateY(-5px);
        }

        .upload-area i {
            font-size: 3.2rem;
            color: var(--primary-blue);
            margin-bottom: 20px;
            position: relative;
            z-index: 1;
            transition: var(--transition);
        }

        .upload-area:hover i {
            transform: scale(1.1) rotate(5deg);
            color: var(--dark-blue);
        }

        .upload-text {
            margin: 10px 0;
            font-size: 1.15rem;
            color: var(--dark-gray);
            position: relative;
            z-index: 1;
        }

        .highlight {
            color: var(--dark-blue);
            font-weight: 600;
        }

        .buttons {
            display: flex;
            gap: 20px;
            margin-top: 25px;
            flex-wrap: wrap;
            animation: fadeInUp 0.8s ease-out;
        }

        @keyframes fadeInUp {
            from {
                transform: translateY(30px);
                opacity: 0;
            }

            to {
                transform: translateY(0);
                opacity: 1;
            }
        }

        button {
            flex: 1;
            min-width: 150px;
            padding: 16px 20px;
            border: none;
            border-radius: 10px;
            font-size: 1.15rem;
            font-weight: 600;
            cursor: pointer;
            transition: var(--transition);
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
            position: relative;
            overflow: hidden;
            box-shadow: var(--shadow);
            background: linear-gradient(120deg, var(--light-blue), var(--white));
            color: var(--dark-blue);
            border: 1px solid var(--light-blue);
        }

        button::after {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
            transform: translateX(-100%);
        }

        button:hover::after {
            animation: shine-btn 0.8s ease;
        }

        @keyframes shine-btn {
            100% {
                transform: translateX(100%);
            }
        }

        button:hover {
            background: linear-gradient(120deg, var(--accent-blue), var(--white));
            transform: translateY(-5px) scale(1.02);
            box-shadow: 0 8px 20px rgba(24, 144, 255, 0.2);
        }

        .results-container {
            height: 500px;
            overflow-y: auto;
            border-radius: var(--radius);
            background: var(--light-gray);
            box-shadow: var(--shadow);
            position: relative;
            border: 1px solid rgba(230, 247, 255, 0.8);
        }

        .results-header {
            position: sticky;
            top: 0;
            background: linear-gradient(to right, var(--light-blue), var(--white));
            padding: 15px 20px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            z-index: 10;
            border-bottom: 1px solid rgba(230, 247, 255, 0.5);
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
        }

        .filters {
            display: flex;
            gap: 10px;
        }

        .filter-btn {
            padding: 8px 15px;
            border-radius: 20px;
            background: rgba(24, 144, 255, 0.1);
            border: 1px solid var(--light-blue);
            color: var(--dark-blue);
            font-size: 0.9rem;
            font-weight: 500;
            cursor: pointer;
            transition: var(--transition);
            display: flex;
            align-items: center;
            gap: 5px;
        }

        .filter-btn:hover {
            background: rgba(24, 144, 255, 0.2);
            transform: translateY(-2px);
        }

        .filter-btn.active {
            background: var(--primary-blue);
            color: white;
        }

        .filter-btn i {
            font-size: 0.9rem;
        }

        .results {
            padding: 15px;
        }

        .result-item {
            padding: 16px 20px;
            margin-bottom: 15px;
            border-radius: 10px;
            font-family: 'Consolas', 'Courier New', monospace;
            display: flex;
            align-items: center;
            gap: 15px;
            animation: slideIn 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
            opacity: 0;
            transform: translateX(30px);
            position: relative;
            overflow: hidden;
            box-shadow: 0 3px 8px rgba(0, 0, 0, 0.05);
            transition: var(--transition);
        }

        .result-item:hover {
            transform: translateY(-3px);
            box-shadow: 0 6px 12px rgba(0, 0, 0, 0.08);
        }

        @keyframes slideIn {
            0% {
                opacity: 0;
                transform: translateX(30px);
            }

            100% {
                opacity: 1;
                transform: translateX(0);
            }
        }

        .error {
            background: rgba(255, 77, 79, 0.08);
            border-left: 4px solid var(--error);
        }

        .warn {
            background: rgba(255, 197, 61, 0.08);
            border-left: 4px solid var(--warning);
        }

        .safe {
            background: rgba(82, 196, 26, 0.08);
            border-left: 4px solid var(--success);
        }

        .line-number {
            font-weight: bold;
            color: var(--dark-blue);
            min-width: 70px;
            font-size: 1.1rem;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .line-number i {
            font-size: 1.2rem;
        }

        .summary {
            margin-top: 25px;
            padding: 20px;
            background: linear-gradient(to right, var(--light-blue), var(--white));
            border-radius: var(--radius);
            box-shadow: var(--shadow);
            animation: fadeIn 1s ease-out;
        }

        .summary h3 {
            margin-bottom: 20px;
            color: var(--dark-blue);
            display: flex;
            align-items: center;
            gap: 12px;
            font-size: 1.4rem;
        }

        .stats {
            display: flex;
            gap: 20px;
            flex-wrap: wrap;
        }

        .stat-box {
            flex: 1;
            min-width: 180px;
            padding: 20px;
            border-radius: 10px;
            text-align: center;
            font-weight: bold;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 10px;
            box-shadow: var(--shadow);
            transition: var(--transition);
            cursor: pointer;
            background: linear-gradient(120deg, var(--light-blue), var(--white));
            color: var(--dark-blue);
            border: 1px solid var(--light-blue);
        }

        .stat-box:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
            background: linear-gradient(120deg, var(--accent-blue), var(--white));
        }

        .stat-box .stat-value {
            font-size: 2.2rem;
            font-weight: 700;
            transition: transform 0.3s ease;
        }

        .stat-box:hover .stat-value {
            transform: scale(1.2);
        }

        .errors-box {
            background: rgba(255, 77, 79, 0.08);
            border: 1px solid rgba(255, 77, 79, 0.2);
        }

        .warnings-box {
            background: rgba(255, 197, 61, 0.08);
            border: 1px solid rgba(255, 197, 61, 0.2);
        }

        .lines-box {
            background: rgba(24, 144, 255, 0.08);
            border: 1px solid rgba(24, 144, 255, 0.2);
        }

        .keywords {
            background: white;
            border-radius: 16px;
            overflow: hidden;
            box-shadow: var(--shadow);
            animation: fadeInUp 0.8s ease-out;
        }

        .section-title i {
            margin-right: 12px;
            font-size: 1.3rem;
        }

        .keywords-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
            gap: 25px;
            padding: 30px;
        }

        .keyword-card {
            padding: 25px;
            border-radius: 12px;
            font-size: 1rem;
            box-shadow: var(--shadow);
            transition: var(--transition);
            position: relative;
            overflow: hidden;
            animation: fadeIn 0.8s ease-out;
        }

        .keyword-card.error {
            background: var(--light-red);
            border: 1px solid var(--medium-red);
        }

        .keyword-card.warn {
            background: var(--light-yellow);
            border: 1px solid var(--medium-yellow);
        }

        .keyword-card h3 {
            display: flex;
            align-items: center;
            margin-bottom: 20px;
            font-size: 1.3rem;
            color: var(--dark-blue);
            padding-bottom: 12px;
            border-bottom: 1px solid rgba(0, 0, 0, 0.1);
        }

        .keyword-card h3 i {
            margin-right: 10px;
        }

        .keywords-container {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
        }

        .keyword-tag {
            display: inline-block;
            padding: 8px 16px;
            border-radius: 20px;
            font-size: 0.9rem;
            font-weight: 500;
            transition: var(--transition);
            cursor: default;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
        }

        .error .keyword-tag {
            background: var(--light-red);
            border: 1px solid var(--medium-red);
            color: #c41a1a;
        }

        .warn .keyword-tag {
            background: var(--light-yellow);
            border: 1px solid var(--medium-yellow);
            color: #d48806;
        }

        .keyword-tag:hover {
            transform: translateY(-3px);
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
        }

        .error .keyword-tag:hover {
            background: #fff;
            border-color: var(--dark-red);
        }

        .warn .keyword-tag:hover {
            background: #fff;
            border-color: var(--dark-yellow);
        }

        /* .keywords {
            padding: 0 30px 30px;
            animation: fadeIn 1.2s ease-out;
        }

        .keywords-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
            gap: 20px;
            margin-top: 15px;
        }

        .keyword-card {
            padding: 20px;
            border-radius: 10px;
            font-size: 1rem;
            box-shadow: var(--shadow);
            transition: var(--transition);
            position: relative;
            overflow: hidden;
            animation: fadeInUp 0.8s ease-out;
            background: linear-gradient(120deg, var(--light-blue), var(--white));
            border: 1px solid var(--light-blue);
        }

        .keyword-card::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.3), transparent);
            transform: translateX(-100%);
            z-index: 0;
        }

        .keyword-card:hover::before {
            animation: shine 1.5s ease;
        }

        .keyword-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
            background: linear-gradient(120deg, var(--accent-blue), var(--white));
        }

        .keyword-card.error {
            background: rgba(255, 77, 79, 0.05);
            border: 1px solid rgba(255, 77, 79, 0.15);
        }

        .keyword-card.warn {
            background: rgba(255, 197, 61, 0.05);
            border: 1px solid rgba(255, 197, 61, 0.15);
        }

        .keyword-card strong {
            display: block;
            margin-bottom: 15px;
            font-size: 1.2rem;
            color: var(--dark-blue);
        }

        .keyword-card div {
            padding: 8px 10px;
            margin: 5px 0;
            background: rgba(255, 255, 255, 0.5);
            border-radius: 6px;
            transition: var(--transition);
        }

        .keyword-card div:hover {
            background: rgba(255, 255, 255, 0.9);
            transform: translateX(5px);
        } */

        /* 底部波浪动画 */
        .harmony-wave {
            position: absolute;
            bottom: -10px;
            left: 0;
            width: 100%;
            height: 20px;
            background: url('data:image/svg+xml;utf8,<svg viewBox="0 0 1200 120" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="none"><path d="M0,0V46.29c47.79,22.2,103.59,32.17,158,28,70.36-5.37,136.33-33.31,206.8-37.5C438.64,32.43,512.34,53.67,583,72.05c69.27,18,138.3,24.88,209.4,13.08,36.15-6,69.85-17.84,104.45-29.34C989.49,25,1113-14.29,1200,52.47V0Z" opacity=".25" fill="%231890ff"/><path d="M0,0V15.81C13,36.92,27.64,56.86,47.69,72.05,99.41,111.27,165,111,224.58,91.58c31.15-10.15,60.09-26.07,89.67-39.8,40.92-19,84.73-46,130.83-49.67,36.26-2.85,70.9,9.42,98.6,31.56,31.77,25.39,62.32,62,103.63,73,40.44,10.79,81.35-6.69,119.13-24.28s75.16-39,116.92-43.05c59.73-5.85,113.28,22.88,168.9,38.84,30.2,8.66,59,6.17,87.09-7.5,22.43-10.89,48-26.93,60.65-49.24V0Z" opacity=".5" fill="%231890ff"/><path d="M0,0V5.63C149.93,59,314.09,71.32,475.83,42.57c43-7.64,84.23-20.12,127.61-26.46,59-8.63,112.48,12.24,165.56,35.4C827.93,77.22,886,95.24,951.2,90c86.53-7,172.46-45.71,248.8-84.81V0Z" fill="%231890ff"/></svg>');
            background-size: 1200px 100px;
            animation: wave 12s linear infinite;
        }

        @keyframes wave {
            0% {
                background-position-x: 0;
            }

            100% {
                background-position-x: 1200px;
            }
        }

        /* 无结果动画 */
        .no-results {
            text-align: center;
            padding: 60px 20px;
            color: var(--dark-gray);
            animation: fadeInBounce 1s ease-out;
        }

        .no-results i {
            font-size: 4rem;
            color: var(--primary-blue);
            margin-bottom: 20px;
            display: block;
            animation: pulse 2s infinite;
        }

        @keyframes pulse {
            0% {
                transform: scale(1);
                opacity: 0.7;
            }

            50% {
                transform: scale(1.1);
                opacity: 1;
            }

            100% {
                transform: scale(1);
                opacity: 0.7;
            }
        }

        @keyframes fadeInBounce {
            0% {
                opacity: 0;
                transform: translateY(30px);
            }

            70% {
                opacity: 1;
                transform: translateY(-10px);
            }

            100% {
                opacity: 1;
                transform: translateY(0);
            }
        }

        /* 文件上传动画 */
        .file-uploaded {
            animation: fileUploaded 0.5s ease-out;
        }

        @keyframes fileUploaded {
            0% {
                transform: scale(0.9);
                opacity: 0;
            }

            100% {
                transform: scale(1);
                opacity: 1;
            }
        }

        /* 结果项动画增强 */
        .result-item.animated {
            animation: resultItemAppear 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        }

        @keyframes resultItemAppear {
            0% {
                opacity: 0;
                transform: translateX(50px) rotate(5deg);
            }

            70% {
                opacity: 1;
                transform: translateX(-5px) rotate(-2deg);
            }

            100% {
                opacity: 1;
                transform: translateX(0) rotate(0);
            }
        }

        /* 统计卡片动画 */
        .stat-box.updated {
            animation: statUpdate 0.8s ease;
        }

        @keyframes statUpdate {
            0% {
                transform: scale(1);
            }

            50% {
                transform: scale(1.15);
            }

            100% {
                transform: scale(1);
            }
        }

        /* 按钮点击动画 */
        button:active {
            transform: scale(0.98);
        }

        /* 输入框加载动画 */
        .code-input.loading {
            background-image: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
            background-size: 200% 100%;
            animation: loading 1.5s infinite;
        }

        @keyframes loading {
            0% {
                background-position: 200% 0;
            }

            100% {
                background-position: -200% 0;
            }
        }

        /* 结果容器滚动条 */
        .results-container::-webkit-scrollbar {
            width: 10px;
        }

        .results-container::-webkit-scrollbar-track {
            background: rgba(230, 247, 255, 0.5);
            border-radius: 10px;
        }

        .results-container::-webkit-scrollbar-thumb {
            background: var(--accent-blue);
            border-radius: 10px;
        }

        .results-container::-webkit-scrollbar-thumb:hover {
            background: var(--dark-blue);
        }

        @media (max-width: 1100px) {
            .content {
                flex-direction: column;
            }

            .buttons {
                flex-direction: row;
            }
        }

        @media (max-width: 768px) {
            .buttons {
                flex-direction: column;
            }

            .stat-box {
                min-width: 100%;
            }

            h1 {
                font-size: 2.2rem;
            }

            .subtitle {
                font-size: 1.1rem;
            }

            .code-input {
                height: 300px;
            }

            .results-container {
                height: 400px;
            }
        }

        @media (max-width: 480px) {
            .content {
                padding: 20px;
            }

            header {
                padding: 20px;
            }

            .logo {
                width: 50px;
                height: 50px;
            }

            h1 {
                font-size: 1.8rem;
            }

            .section-title {
                font-size: 1.4rem;
            }

            .filters {
                flex-wrap: wrap;
                justify-content: center;
            }
        }

        .error-code:hover {
            border: 1.5px solid var(--error);
            border-radius: 2px;
            color: var(--error);
            background-color: #F6E8E8;
        }

        .error-code {
            background-color: var(--error);
            color: white;
        }

        .warn-code:hover {
            border: 1.5px solid var(--warning);
            border-radius: 2px;
            color: var(--warning);
            background-color: #F6F1E7;
        }

        .warn-code {
            background-color: var(--warning);
            color: white;
        }

        #floating-menu {
            background: #fff;
            border: 1px solid transparent;
            border-radius: 8px;
            box-shadow: 0 0 2px rgba(0, 0, 0, 0.2), 0 calc(32 * 0.5px) calc((32 * 1px)) rgba(0, 0, 0, 0.24);
            margin: 0px;
            padding: 4px 0;
            max-width: 368px;
            min-width: 64px;
            position: fixed;
            z-index: 999999;
            overflow: hidden;
        }

        .menu-item {
            contain: layout;
            overflow: visible;
            font-family: Segoe UI, sans-serif;
            outline: none;
            box-sizing: border-box;
            height: 32px;
            grid-template-columns: minmax(32px, auto) 1fr minmax(32px, auto);
            grid-template-rows: auto;
            place-items: center;
            padding: 0px;
            margin: 0 4;
            white-space: nowrap;
            color: #212121;
            fill: currentcolor;
            cursor: pointer;
            font-size: 14px;
            line-height: 20px;
            border-radius: 4px;
            border: 1px solid transparent;
        }

        .menu-item:hover {
            background-color: F3F3F3;
        }
    </style>
</head>

<body>
    <!-- 粒子背景 -->
    <div class="particles" id="particles"></div>

    <div class="container">
        <header>
            <div class="logo-container">
                <div class="logo">
                    <i class="fas fa-code"></i>
                </div>
                <div>
                    <h1>CoCo自定义控件代码检查工具</h1>
                    <div class="subtitle">快速检测CoCo自定义控件的代码中的禁止关键字与限制变量</div>
                </div>
            </div>
            <div class="harmony-wave"></div>
        </header>

        <div class="content">
            <div class="input-section">
                <h2 class="section-title">
                    <i class="fas fa-code"></i> 输入代码
                </h2>
                <div class="code-input-container">
                    <div class="code-input-header">
                        <span>CodeEditor.js</span>
                        <span><i class="fas fa-expand-alt"></i></span>
                    </div>
                    <textarea id="codeInput" class="code-input" placeholder="粘贴您的代码到这里，或拖入控件文件..."></textarea>
                </div>

                <div id="uploadArea" class="upload-area">
                    <i class="fas fa-cloud-upload-alt"></i>
                    <div class="upload-text">拖放控件文件到此处</div>
                    <div class="upload-text">或 <span class="highlight">点击此处</span> 选择文件</div>
                    <input type="file" id="fileInput" style="display: none" accept=".js,.txt,.user.js,.ts,.html,.css">
                </div>

                <div class="buttons">
                    <button id="checkBtn" class="check-btn">
                        <i class="fas fa-search"></i> 检查代码
                    </button>
                    <button id="clearBtn" class="clear-btn">
                        <i class="fas fa-trash-alt"></i> 清除内容
                    </button>
                    <button id="saveBtn" class="save-btn">
                        <i class="fas fa-save"></i> 保存报告
                    </button>
                    <button id="examplesBtn" class="examples-btn">
                        <i class="fas fa-file-code"></i> 示例代码
                    </button>
                </div>
            </div>

            <div class="output-section">
                <h2 class="section-title">
                    <i class="fas fa-clipboard-list"></i> 检查结果
                </h2>
                <div class="results-container">
                    <div class="results-header">
                        <div class="filters">
                            <button class="filter-btn active" data-filter="all">
                                <i class="fas fa-layer-group"></i> 全部
                            </button>
                            <button class="filter-btn" data-filter="error">
                                <i class="fas fa-exclamation-circle"></i> 错误
                            </button>
                            <button class="filter-btn" data-filter="warn">
                                <i class="fas fa-exclamation-triangle"></i> 警告
                            </button>
                            <!-- <button class="filter-btn" data-filter="safe">
                                <i class="fas fa-check-circle"></i> 安全
                            </button> -->
                        </div>
                    </div>
                    <div id="resultsContainer" class="results">
                        <div style="text-align:center; padding:50px 20px; color:#666; font-size:1.1rem;">
                            <i class="fas fa-clipboard-list"
                                style="font-size:3rem; margin-bottom:20px; color:var(--primary-blue);"></i>
                            <p>输入代码后点击"检查代码"，结果将显示在这里</p>
                        </div>
                    </div>
                </div>

                <div class="summary">
                    <h3><i class="fas fa-chart-bar"></i> 代码统计</h3>
                    <div class="stats">
                        <div class="stat-box errors-box" id="errorStat">
                            <div>禁止关键字</div>
                            <div class="stat-value" id="errorCount">0</div>
                        </div>
                        <div class="stat-box warnings-box" id="warningStat">
                            <div>限制变量</div>
                            <div class="stat-value" id="warningCount">0</div>
                        </div>
                        <div class="stat-box lines-box" id="lineStat">
                            <div>代码行数</div>
                            <div class="stat-value" id="lineCount">0</div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="keywords">
            <h2 class="section-title" style="margin-left: 30px;">
                <i class="fas fa-exclamation-triangle"></i> 检测关键字
            </h2>
            <div class="keywords-grid">
                <div class="keyword-card error">
                    <h3><i class="fas fa-ban"></i> 禁止关键字</h3>
                    <div class="keywords-container">
                        <span class="keyword-tag">parent.location</span>
                        <span class="keyword-tag">top.location</span>
                        <span class="keyword-tag">WebSocket</span>
                        <span class="keyword-tag">XMLHttpRequest</span>
                        <span class="keyword-tag">.fetch</span>
                        <span class="keyword-tag">socketcv.codemao.cn</span>
                        <span class="keyword-tag">eval()</span>
                    </div>
                </div>

                <div class="keyword-card warn">
                    <h3><i class="fas fa-exclamation-circle"></i> 限制变量</h3>
                    <div class="keywords-container">
                        <span class="keyword-tag">window</span>
                        <span class="keyword-tag">getElementById</span>
                        <span class="keyword-tag">history</span>
                        <span class="keyword-tag">navigator</span>
                        <span class="keyword-tag">userAgent</span>
                        <span class="keyword-tag">localStorage</span>
                        <span class="keyword-tag">top</span>
                        <span class="keyword-tag">self</span>
                        <span class="keyword-tag">parent</span>
                        <span class="keyword-tag">frames</span>
                        <span class="keyword-tag">opener</span>
                        <span class="keyword-tag">fetch</span>
                        <span class="keyword-tag">XMLHttpRequest</span>
                        <span class="keyword-tag">location</span>
                        <span class="keyword-tag">open</span>
                        <span class="keyword-tag">alert</span>
                        <span class="keyword-tag">confirm</span>
                        <span class="keyword-tag">prompt</span>
                        <span class="keyword-tag">print</span>
                        <span class="keyword-tag">sessionStorage</span>
                        <span class="keyword-tag">postMessage</span>
                        <span class="keyword-tag">eval</span>
                    </div>
                </div>
            </div>
        </div>
        <div id="floating-menu">
            快速修复
            <div class="menu-item">new Function("return window")</div>
        </div>
        <script>
            document.addEventListener('DOMContentLoaded', function () {
                // 创建粒子背景
                createParticles();

                const codeInput = document.getElementById('codeInput');
                const fileInput = document.getElementById('fileInput');
                const uploadArea = document.getElementById('uploadArea');
                const checkBtn = document.getElementById('checkBtn');
                const clearBtn = document.getElementById('clearBtn');
                const saveBtn = document.getElementById('saveBtn');
                const examplesBtn = document.getElementById('examplesBtn');
                const resultsContainer = document.getElementById('resultsContainer');
                const errorCount = document.getElementById('errorCount');
                const warningCount = document.getElementById('warningCount');
                const lineCount = document.getElementById('lineCount');
                const filterButtons = document.querySelectorAll('.filter-btn');
                const errorStat = document.getElementById('errorStat');
                const warningStat = document.getElementById('warningStat');
                const lineStat = document.getElementById('lineStat');
                const floatingMenu = document.getElementById('floating-menu')
                // 当前筛选状态
                let currentFilter = 'all';

                // 禁止的关键字列表
                const forbiddenKeywords = [
                    "parent.location",
                    "top.location",
                    "WebSocket",
                    "XMLHttpRequest",
                    ".fetch",
                    "socketcv.codemao.cn"
                ];

                // 限制的变量列表
                const restrictedVariables = [
                    "window",
                    "getElementById",
                    "history",
                    "navigator",
                    "userAgent",
                    "localStorage",
                    "top",
                    "self",
                    "parent",
                    "frames",
                    "opener",
                    "fetch",
                    "XMLHttpRequest",
                    "location",
                    "open",
                    "alert",
                    "confirm",
                    "prompt",
                    "print",
                    "sessionStorage",
                    "postMessage",
                    "eval"
                ];

                // 粒子背景创建
                function createParticles() {
                    const particlesContainer = document.getElementById('particles');
                    const particleCount = 30;

                    for (let i = 0; i < particleCount; i++) {
                        const particle = document.createElement('div');
                        particle.classList.add('particle');

                        // 随机位置
                        const posX = Math.random() * 100;
                        const posY = Math.random() * 100;

                        // 随机大小
                        const size = Math.random() * 20 + 5;

                        // 随机动画延迟
                        const delay = Math.random() * 15;

                        particle.style.left = `${posX}%`;
                        particle.style.top = `${posY}%`;
                        particle.style.width = `${size}px`;
                        particle.style.height = `${size}px`;
                        particle.style.animationDelay = `${delay}s`;
                        particle.style.opacity = Math.random() * 0.5 + 0.1;

                        particlesContainer.appendChild(particle);
                    }
                }

                // 筛选按钮事件
                filterButtons.forEach(button => {
                    button.addEventListener('click', () => {
                        // 更新活动按钮
                        filterButtons.forEach(btn => btn.classList.remove('active'));
                        button.classList.add('active');

                        // 更新筛选状态
                        currentFilter = button.dataset.filter;

                        // 应用筛选
                        applyFilter();
                    });
                });

                // 应用筛选
                function applyFilter() {
                    const resultItems = resultsContainer.querySelectorAll('.result-item');
                    let visibleCount = 0;

                    // 首先隐藏所有结果项
                    resultItems.forEach(item => {
                        item.style.display = 'none';
                        item.style.opacity = '0';
                        item.style.transform = 'translateY(20px)';
                    });

                    // 显示匹配筛选条件的结果项
                    resultItems.forEach(item => {
                        const type = item.classList.contains('error') ? 'error' :
                            item.classList.contains('warn') ? 'warn' : 'safe';

                        if (currentFilter === 'all' || currentFilter === type) {
                            item.style.display = 'flex';
                            setTimeout(() => {
                                item.style.opacity = '1';
                                item.style.transform = 'translateY(0)';
                            }, 10);
                            visibleCount++;
                        }
                    });

                    // 如果没有结果显示
                    if (visibleCount === 0) {
                        const noResults = document.createElement('div');
                        noResults.className = 'no-results';
                        noResults.innerHTML = `
                        <i class="fas fa-search"></i>
                        <h3>没有找到${getFilterName(currentFilter)}内容</h3>
                        <p>当前筛选条件没有匹配的结果</p>
                    `;

                        // 移除原有的无结果提示（如果有）
                        const existingNoResults = resultsContainer.querySelector('.no-results');
                        if (existingNoResults) {
                            existingNoResults.remove();
                        }

                        resultsContainer.appendChild(noResults);
                    } else {
                        // 移除无结果提示（如果有）
                        const noResults = resultsContainer.querySelector('.no-results');
                        if (noResults) {
                            noResults.remove();
                        }
                    }
                }

                // 获取筛选名称
                function getFilterName(filter) {
                    switch (filter) {
                        case 'error': return '错误';
                        case 'warn': return '警告';
                        case 'safe': return '安全';
                        default: return '';
                    }
                }

                // 点击上传区域触发文件选择
                uploadArea.addEventListener('click', () => {
                    fileInput.click();
                });

                // 文件选择处理
                fileInput.addEventListener('change', (e) => {
                    const file = e.target.files[0];
                    if (file) {
                        readFile(file);
                    }
                });

                // 拖放功能
                uploadArea.addEventListener('dragover', (e) => {
                    e.preventDefault();
                    uploadArea.style.background = 'rgba(230, 247, 255, 0.7)';
                    uploadArea.style.borderColor = 'var(--accent-blue)';
                });

                uploadArea.addEventListener('dragleave', () => {
                    uploadArea.style.background = 'rgba(230, 247, 255, 0.4)';
                    uploadArea.style.borderColor = 'var(--primary-blue)';
                });

                uploadArea.addEventListener('drop', (e) => {
                    e.preventDefault();
                    uploadArea.style.background = 'rgba(230, 247, 255, 0.4)';
                    uploadArea.style.borderColor = 'var(--primary-blue)';

                    const file = e.dataTransfer.files[0];
                    if (file) {
                        readFile(file);
                    }
                });

                // 读取文件内容
                function readFile(file) {
                    const reader = new FileReader();
                    reader.onload = (e) => {
                        codeInput.value = e.target.result;
                        updateLineCount();

                        // 添加上传成功反馈
                        uploadArea.innerHTML = `
                        <i class="fas fa-check-circle" style="color:var(--success);"></i>
                        <div class="upload-text">已加载: ${file.name}</div>
                        <div class="upload-text">文件大小: ${formatFileSize(file.size)}</div>
                    `;
                        uploadArea.classList.add('file-uploaded');

                        setTimeout(() => {
                            uploadArea.classList.remove('file-uploaded');
                            uploadArea.innerHTML = `
                            <i class="fas fa-cloud-upload-alt"></i>
                            <div class="upload-text">拖放控件文件到此处</div>
                            <div class="upload-text">或 <span class="highlight">点击此处</span> 选择文件</div>
                        `;
                        }, 3000);
                    };
                    reader.readAsText(file);
                }

                function formatFileSize(bytes) {
                    if (bytes < 1024) return bytes + " bytes";
                    else if (bytes < 1048576) return (bytes / 1024).toFixed(1) + " KB";
                    else return (bytes / 1048576).toFixed(1) + " MB";
                }

                // 检查代码按钮
                checkBtn.addEventListener('click', () => {
                    function removeStrings(code) { let result = ''; let i = 0; const n = code.length; let inSingleQuote = false; let inDoubleQuote = false; let inTemplate = false; let inSingleLineComment = false; let inMultiLineComment = false; let escapeNext = false; while (i < n) { const char = code[i]; const nextChar = i < n - 1 ? code[i + 1] : ''; if (char === '\n') { result += '\n'; if (inSingleLineComment) { inSingleLineComment = false } i++; escapeNext = false; continue } if (escapeNext) { escapeNext = false; i++; continue } if ((inSingleQuote || inDoubleQuote || inTemplate) && char === '\\') { escapeNext = true; i++; continue } if (!inSingleQuote && !inDoubleQuote && !inTemplate && !inSingleLineComment && !inMultiLineComment) { if (char === '/' && nextChar === '/') { inSingleLineComment = true; i += 2; continue } if (char === '/' && nextChar === '*') { inMultiLineComment = true; i += 2; continue } if (char === "'") { inSingleQuote = true; i++; continue } if (char === '"') { inDoubleQuote = true; i++; continue } if (char === '`') { inTemplate = true; i++; continue } } if (inSingleLineComment) { i++; continue } if (inMultiLineComment) { if (char === '*' && nextChar === '/') { inMultiLineComment = false; i += 2; continue } i++; continue } if (inSingleQuote) { if (char === "'") { inSingleQuote = false; i++; continue } i++; continue } if (inDoubleQuote) { if (char === '"') { inDoubleQuote = false; i++; continue } i++; continue } if (inTemplate) { if (char === '`') { inTemplate = false; i++; continue } i++; continue } result += char; i++ } return result }
                    const code = codeInput.value;
                    if (!code.trim()) {
                        showNotification('请输入代码或上传文件', 'error');
                        return;
                    }

                    // 添加加载效果
                    codeInput.classList.add('loading');
                    setTimeout(() => {
                        codeInput.classList.remove('loading');
                        checkCode(removeStrings(code), code);
                    }, 1);
                });

                // 清除按钮
                clearBtn.addEventListener('click', () => {
                    // 添加清除动画
                    clearBtn.querySelector('i').classList.add('fa-spin');
                    setTimeout(() => {
                        clearBtn.querySelector('i').classList.remove('fa-spin');
                    }, 1000);

                    // 重置代码输入
                    codeInput.value = '';

                    // 重置结果区域
                    resultsContainer.innerHTML = `
                    <div style="text-align:center; padding:50px 20px; color:#666; font-size:1.1rem;">
                        <i class="fas fa-clipboard-list" style="font-size:3rem; margin-bottom:20px; color:var(--primary-blue);"></i>
                        <p>输入代码后点击"检查代码"，结果将显示在这里</p>
                    </div>
                `;

                    // 重置统计
                    errorCount.textContent = '0';
                    warningCount.textContent = '0';
                    lineCount.textContent = '0';

                    // 重置文件输入和上传区域
                    fileInput.value = '';
                    uploadArea.innerHTML = `
                    <i class="fas fa-cloud-upload-alt"></i>
                    <div class="upload-text">拖放控件文件到此处</div>
                    <div class="upload-text">或 <span class="highlight">点击此处</span> 选择文件</div>
                `;

                    // 重置筛选
                    filterButtons.forEach(btn => btn.classList.remove('active'));
                    document.querySelector('.filter-btn[data-filter="all"]').classList.add('active');
                    currentFilter = 'all';

                    showNotification('内容已清除', 'success');
                });

                // 保存报告按钮
                saveBtn.addEventListener('click', () => {
                    if (!resultsContainer.querySelector('.result-item')) {
                        showNotification('没有可保存的结果', 'warning');
                        return;
                    }

                    // 添加保存动画
                    saveBtn.querySelector('i').classList.add('fa-beat');
                    setTimeout(() => {
                        saveBtn.querySelector('i').classList.remove('fa-beat');
                    }, 1000);

                    const content = generateReportContent();
                    const blob = new Blob([content], { type: 'text/plain' });
                    const url = URL.createObjectURL(blob);
                    const a = document.createElement('a');
                    a.href = url;
                    a.download = '代码检查报告.txt';
                    document.body.appendChild(a);
                    a.click();
                    document.body.removeChild(a);
                    URL.revokeObjectURL(url);

                    showNotification('报告已保存', 'success');
                });

                // 示例代码按钮
                examplesBtn.addEventListener('click', () => {
                    // 添加加载动画
                    examplesBtn.querySelector('i').classList.add('fa-shake');
                    setTimeout(() => {
                        examplesBtn.querySelector('i').classList.remove('fa-shake');
                    }, 500);

                    const examples = [
                        {
                            name: "WebSocket示例",
                            code: `// WebSocket使用示例（禁止）
function connectWebSocket() {
    const socket = new WebSocket('wss://example.com');
    socket.onmessage = function(event) {
        console.log('Message from server:', event.data);
    };
    socket.send('Hello Server!');
    
    // 另一个禁止关键字
    top.location = 'https://example.com';
}`
                        },
                        {
                            name: "安全代码示例",
                            code: `// 安全代码示例
function safeFunction() {
    // 安全的使用方式
    const safeVar = "安全内容";
    
    // 允许的操作
    console.log('安全日志记录');
    
    // 使用HarmonyOS API
    const deviceInfo = harmonyos.device.getInfo();
    console.log('设备类型:', deviceInfo.deviceType);
}`
                        },
                        {
                            name: "混合代码示例",
                            code: `// 混合代码（包含禁止和限制内容）
function mixedExample() {
    // 禁止的关键字
    const xhr = new XMLHttpRequest();
    xhr.open('GET', 'https://api.example.com', true);
    
    // 限制的变量
    alert('这是一个警告');
    window.location.href = 'https://example.com';
    
    // 安全代码
    const safeVar = '安全变量';
    
    // 另一个禁止关键字
    eval('console.log("动态执行")');
    
    // 更多安全代码
    for (let i = 0; i < 5; i++) {
        console.log(i);
    }
}`
                        }
                    ];

                    const randomExample = examples[Math.floor(Math.random() * examples.length)];
                    codeInput.value = randomExample.code;
                    updateLineCount();

                    showNotification(`已加载示例: ${randomExample.name}`, 'success');
                });

                // 点击统计卡片筛选结果
                errorStat.addEventListener('click', () => {
                    filterButtons.forEach(btn => btn.classList.remove('active'));
                    document.querySelector('.filter-btn[data-filter="error"]').classList.add('active');
                    currentFilter = 'error';
                    applyFilter();
                });

                warningStat.addEventListener('click', () => {
                    filterButtons.forEach(btn => btn.classList.remove('active'));
                    document.querySelector('.filter-btn[data-filter="warn"]').classList.add('active');
                    currentFilter = 'warn';
                    applyFilter();
                });

                lineStat.addEventListener('click', () => {
                    filterButtons.forEach(btn => btn.classList.remove('active'));
                    document.querySelector('.filter-btn[data-filter="all"]').classList.add('active');
                    currentFilter = 'all';
                    applyFilter();
                });

                // 代码输入时更新行数
                codeInput.addEventListener('input', updateLineCount);

                function updateLineCount() {
                    const lines = codeInput.value.split('\n').length;
                    lineCount.textContent = lines;
                }
                // 检查代码逻辑
                function checkCode(code, realCode) {
                    // 重置结果
                    resultsContainer.innerHTML = '';
                    let errorTotal = 0;
                    let warningTotal = 0;

                    const lines = code.split('\n');
                    const realLines = realCode.split('\n');
                    let hasResults = false;

                    for (let i = 0; i < lines.length; i++) {
                        const line = lines[i];
                        const realLine = realLines[i];
                        const lineNumber = i + 1;
                        let lineHasError = false;
                        let lineHasWarning = false;

                        // 检查禁止关键字
                        for (const keyword of forbiddenKeywords) {
                            if (line.includes(keyword)) {
                                const resultItem = document.createElement('div');
                                resultItem.className = 'result-item error animated';
                                resultItem.setAttribute('data-type', 'error');
                                resultItem.innerHTML = `
                                <div class="line-number"><i class="fas fa-ban"></i> ${lineNumber}</div>
                                <div>${escapeHtml(realLine.trim())
                                        .replaceAll(keyword,
                                            `<span class="error-code">${keyword}</span>`)
                                    } <br><span style="color:var(--error);display: none">(禁止的关键字: ${keyword})</span></div>
                                `;
                                resultsContainer.appendChild(resultItem);
                                errorTotal++;
                                hasResults = true;
                                lineHasError = true;
                                break;
                            }
                        }
                        resultsContainer.querySelectorAll('span.error-code').forEach((span) => {
                            span.addEventListener('mouseover', (e) => {
                                floatingMenu.style.left = e.pageX + 'px';
                                floatingMenu.style.top = e.pageY - 50 + 'px';
                            });
                            span.addEventListener('mouseout', (e) => {
                                floatingMenu.style.left = '-1000px';
                                floatingMenu.style.top = '-1000px';
                            });
                        });
                        // 如果没有错误，检查限制变量
                        if (!lineHasError) {
                            for (const variable of restrictedVariables) {
                                if (line.includes(variable)) {
                                    const resultItem = document.createElement('div');
                                    resultItem.className = 'result-item warn animated';
                                    resultItem.setAttribute('data-type', 'warn');
                                    resultItem.innerHTML = `
                                    <div class="line-number"><i class="fas fa-exclamation-triangle"></i> ${lineNumber}</div>
                                    <div>${escapeHtml(realLine.trim())
                                            .replaceAll(variable,
                                                `<span class="warn-code">${variable}</span>`)
                                        } <br><span style="color:var(--warning);display: none">(被限制的变量: ${variable})</span></div>
                                    `;
                                    resultsContainer.appendChild(resultItem);
                                    warningTotal++;
                                    hasResults = true;
                                    lineHasWarning = true;
                                    break;
                                }
                            }
                        }

                        // 如果既没有错误也没有警告，显示安全行（仅显示非空行）
                        // if (!lineHasError && !lineHasWarning && line.trim() !== '') {
                        if (false) {
                            const resultItem = document.createElement('div');
                            resultItem.className = 'result-item safe animated';
                            resultItem.setAttribute('data-type', 'safe');
                            resultItem.innerHTML = `
                            <div class="line-number"><i class="fas fa-check-circle"></i> ${lineNumber}</div>
                            <div>${escapeHtml(realLine.trim())}</div>
                        `;
                            resultsContainer.appendChild(resultItem);
                            hasResults = true;
                        }
                    }

                    // 如果没有结果，显示提示
                    if (!hasResults) {
                        resultsContainer.innerHTML = `
                        <div class="result-item safe" style="justify-content:center; text-align:center; animation: fadeInBounce 1s;">
                            <i class="fas fa-check-circle" style="color:var(--success); font-size:2rem; margin-right:15px;"></i>
                            <div style="font-size:1.3rem; font-weight:bold;">未检测到禁止关键字或限制变量！</div>
                        </div>
                    `;
                    }

                    // 更新统计
                    errorCount.textContent = errorTotal;
                    warningCount.textContent = warningTotal;
                    lineCount.textContent = lines.length;

                    // 添加统计更新动画
                    if (errorTotal > 0) errorStat.classList.add('updated');
                    if (warningTotal > 0) warningStat.classList.add('updated');
                    lineStat.classList.add('updated');

                    setTimeout(() => {
                        errorStat.classList.remove('updated');
                        warningStat.classList.remove('updated');
                        lineStat.classList.remove('updated');
                    }, 800);

                    // 应用当前筛选
                    applyFilter();

                    showNotification(`检查完成: ${errorTotal}个错误, ${warningTotal}个警告`,
                        errorTotal > 0 ? 'error' : (warningTotal > 0 ? 'warning' : 'success'));
                }

                function escapeHtml(text) {
                    return text
                        .replace(/&/g, "&amp;")
                        .replace(/</g, "&lt;")
                        .replace(/>/g, "&gt;")
                        .replace(/"/g, "&quot;")
                        .replace(/'/g, "&#039;");
                }

                function generateReportContent() {
                    let report = `===== CoCo自定义控件代码检查报告 =====\n`;
                    report += `生成时间: ${new Date().toLocaleString()}\n`;
                    report += `代码行数: ${lineCount.textContent}\n`;
                    report += `禁止关键字: ${errorCount.textContent}\n`;
                    report += `限制变量: ${warningCount.textContent}\n\n`;
                    report += `===== 详细结果 =====\n\n`;

                    const results = resultsContainer.querySelectorAll('.result-item');
                    results.forEach(item => {
                        const lineNumber = item.querySelector('.line-number').textContent.trim();
                        const content = item.querySelector('div:not(.line-number)').textContent.trim();

                        if (item.classList.contains('error')) {
                            report += `[错误] ${lineNumber}: ${content}\n`;
                        } else if (item.classList.contains('warn')) {
                            report += `[警告] ${lineNumber}: ${content}\n`;
                        } else {
                            report += `[安全] ${lineNumber}: ${content}\n`;
                        }
                    });

                    return report;
                }

                function showNotification(message, type) {
                    const notification = document.createElement('div');
                    notification.className = `notification ${type}`;
                    notification.innerHTML = `
                    <i class="fas fa-${type === 'success' ? 'check-circle' : type === 'warning' ? 'exclamation-triangle' : 'times-circle'}"></i>
                    <span>${message}</span>
                `;

                    document.body.appendChild(notification);

                    setTimeout(() => {
                        notification.style.opacity = '1';
                        notification.style.transform = 'translateY(0)';
                    }, 10);

                    setTimeout(() => {
                        notification.style.opacity = '0';
                        notification.style.transform = 'translateY(-20px)';
                        setTimeout(() => {
                            document.body.removeChild(notification);
                        }, 300);
                    }, 3000);
                }

                // 初始示例代码
                codeInput.value = `// 示例代码
function test() {
    // 禁止关键字示例
    const ws = new WebSocket('ws://example.com');
    const xhr = new XMLHttpRequest();
    fetch('https://api.example.com/data');
    eval('console.log("动态执行")');
    top.location = 'https://example.com';
    
    // 限制变量示例
    window.location.href = 'https://example.com';
    localStorage.setItem('key', 'value');
    alert('Hello World');
    document.getElementById('testElement');
    setTimeout(() => { console.log('延迟执行') }, 1000);
    
    // 安全代码
    console.log('这是安全代码');
    const safeVar = "安全变量";
}`;

                updateLineCount();

                // 添加通知样式
                const style = document.createElement('style');
                style.textContent = `
                .notification {
                    position: fixed;
                    top: 30px;
                    right: 30px;
                    padding: 18px 25px;
                    border-radius: 10px;
                    color: white;
                    font-weight: 500;
                    display: flex;
                    align-items: center;
                    gap: 15px;
                    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
                    z-index: 1000;
                    opacity: 0;
                    transform: translateY(-20px);
                    transition: all 0.4s ease;
                }
                
                .notification.success {
                    background: linear-gradient(120deg, #52c41a, #389e0d);
                }
                
                .notification.warning {
                    background: linear-gradient(120deg, #ffc53d, #fa8c16);
                }
                
                .notification.error {
                    background: linear-gradient(120deg, #ff4d4f, #cf1322);
                }
                
                .notification i {
                    font-size: 1.5rem;
                }
            `;
                document.head.appendChild(style);
            });
        </script>
</body>

</html>